// import Vue from 'vue'// import axios from 'axios'// import ElementUI from 'element-ui'
import App from './App.vue'
import mApp from './mobileApp'
import '../theme/index.css'
import router from './router'
import mRouter from './mAppRouter'
import store from './store'
import global_var from './global_var'
import qs from 'qs'
// import AMap from 'AMap';

Vue.config.devtools = true;
Vue.prototype.Global = global_var;
Vue.prototype.$axios = axios;
Vue.prototype.$qs = qs;
Vue.prototype.AMap = AMap;
// Vue.prototype.mui = mui;

// Vue.config.productionTip = false;

let AppChange= App;
function IsPC() {
    let userAgentInfo = navigator.userAgent;
    let Agents = ["Android", "iPhone",
        "SymbianOS", "Windows Phone",
        "iPad", "iPod"];
    let flag = true;
    for (let v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
            flag = false;
            break;
        }
    }
    return flag;
}

let flag = IsPC(); //true为PC端，false为手机端
/*手机端渲染*/
if(flag === false){
    AppChange= mApp;
    /*添加mui*/
    let mui_css= document.createElement('link');
    mui_css.setAttribute('rel','stylesheet');
    mui_css.setAttribute('type','text/css');
    mui_css.setAttribute('href','mui/css/mui.min.css');
    document.head.appendChild(mui_css);
    let mui_js = document.createElement('script');
    mui_js.src= 'mui/js/mui.min.js';
    document.head.appendChild(mui_js);
    new Vue({
        router:mRouter,
        render: h => h(mApp),
    }).$mount('#app');
}
/*pc端渲染*/
else {
    AppChange= App;
    /*添加pc初始化样式*/
    let initcss= document.createElement('link');
    initcss.setAttribute('rel','stylesheet');
    initcss.setAttribute('type','text/css');
    initcss.setAttribute('href','/initcss.css');
    document.head.appendChild(initcss);
    new Vue({
        router,
        store,
        render: h => h(App),
    }).$mount('#app');
}